package com.liuyang.service.impl;

import com.liuyang.dao.UserDao;
import com.liuyang.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//<bean id="userService" class="com.liuyang.service.impl.UserServiceImpl">
//注解替换bean
/*@Component("userService")*/
//service替代
@Service("userService")
public class UserServiceImpl implements UserService {
//    <property name="userDao" ref="userDao"/>
//    数据注入
//    @Autowired //按照数据类型从Spring容器中进行匹配
//    @Qualifier("userDao") //是按照id值从容器中进行匹配的 但是此处要结合@Autowired一起使用

    @Resource(name = "userDao")
    private UserDao userDao;
    public void save() {
        userDao.save();
    }
}
